<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

		<script src="http://apps.bdimg.com/libs/jquery/1.11.1/jquery.min.js"></script>
		<script src="http://apps.bdimg.com/libs/layer/2.1/layer.js"></script>
		<style>
			table>tbody>tr>td:nth-last-of-type(2){
				display:block;
				border:0;
				border-top:1px solid #ddd;
				width:150px;
				overflow:hidden;
				text-overflow:ellipsis;
				white-space: nowrap;
				}
			table>tbody>tr:nth-of-type(2)>td:nth-last-of-type(2){border-top:0;}
		</style>
	</head>
	<body>  
		<div class="page-header">
  			<h1><p class="text-center">Receive Message</p></h1>
		</div>
    <div ng-app="Notes" ng-controller="NotesCtrl" style="width: 95%;">  
        <table class="table table-bordered"style="margin:20px;">
		<th>id</th>
		<th>name</th>
		<th>phone</th>
		<th>time</th>
		<th>ip</th>
		<th style="width:150px;">message</th>
		<th>详情</th>
		<tr ng-repeat="gee in bee.data" >
		<td onclick="del(this)">{{ gee.id}}</td>
		<td>{{ gee.name}}</td>
		<td>{{ gee.phone}}</td>
		<td>{{ gee.time}}</td>
		<td>{{ gee.ip}}</td>
		<td>{{ gee.message}}</td>
		<td onclick="show(this)">查看</td>
		</tr>
		</table>
		<!--{{ bee.code}}
		{{ bee.msg}}
		{{ bee.data[0].name}}-->
	 	<input type="hidden" class="code" value="{{ bee.code}}">
    </div> 
  <!--   //http://apps.bdimg.com/libs/angular.js/1.5.0-beta.0/angular.js-->

<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
<script src="https://cdn.bootcss.com/angular-resource/1.2.28/angular-resource.min.js"></script>

<script type="text/javascript">  


 
var Demo = angular.module('Notes', ['ngResource']); 
//http://haol.site/link/msg/see
Demo.factory('Notes', ['$resource', function($resource) {
    return $resource('http://www.haol.site/link/msg/see',{},{
    	query: {method:'GET', params:{}, isArray:true}
    });
}]);


Demo.controller('NotesCtrl', ['$scope', 'Notes', function($scope, Notes) {

  Notes.get(function(resp){ 
    //处理成功 
    if(resp.code==0){
     $scope.bee =Notes.get();
    }else{
    	layer.msg('获取失败', {icon:0});
    }
   },function(err){ 
    layer.msg('未知错误', {icon:0});
   }); 
}]);
 
 



function show(e){
//id,name,phone,time,ip,message
//页面层

  	var duc   =$(e).parents('tr').find('td');
  	var value = [];
  	var str   ="";
  	for(var i=0;i<6;i++){
  		value[i] =duc.eq(i).html();
  	}

	str +="<table class='table table-striped'>";
  	str +="<tbody>";
    str +="<tr><td>id</td><td>"+value[0]+"</td></tr>";
    str +="<tr><td>name</td><td>"+value[1]+"</td></tr>";
    str +="<tr><td>phone</td><td>"+value[2]+"</td></tr>";
    str +="<tr><td>time</td><td>"+value[3]+"</td></tr>";
    str +="<tr><td>ip</td><td>"+value[4]+"</td></tr>";
    str +="<tr><td>message</td><td>"+value[5]+"</td></tr>";
    str +="</tbody></table>";

	layer.open({
	  type: 1,
	  skin: 'layui-layer-lan', //样式类名
	  closeBtn: 0, //不显示关闭按钮
	  anim: 3,
	  title:'详细信息',
	  shadeClose: true, //开启遮罩关闭
	  content: str,
	  area: ['500px', '500px'],
	});

}

function del(e){
	var id=$(e).html();
	var tyh=$(e).parents('tr'); 
	
	$.ajax({
				url: "http://localhost:8090/msg/see",
				method: "get",
				dataType: "json",
				data: {},
				success: function(resp){
					if(resp){
						 var points = eval(resp);  
                            
                             alert(points.data[0].name);
						
						return ;
						tyh.remove();
						layer.msg('修改成功', {icon:1});
					
						
					}else{
						layer.msg("修改失败", {icon:2});
					}
			
				},error: function(XMLHttpRequest, textStatus, errorThrown) {
					
				 alert(XMLHttpRequest.status);
				 alert(XMLHttpRequest.readyState);
				 alert(textStatus);
				 layer.msg("修改失败", {icon:2});
				 }

	});
}



    </script>  
</body>  
</html>
